import request from '@/utils/request'

export function apiGetList(params, loading) {
  return request({
    url: `/org/organizationController/list`,
    method: 'get',
    params,
    loading,
    autoUntie: false,
  })
}

export function apiAdd(data) {
  return request({
    url: '/org/organizationController/add',
    method: 'post',
    data: data,
  })
}
export function apiEdit(data) {
  return request({
    url: '/org/organizationController/edit',
    method: 'put',
    data: data,
  })
}

export function apiDel(ids) {
  return request({
    url: '/org/organizationController/' + ids,
    method: 'delete',
  })
}

export function apiGetListManage(params, loading) {
  return request({
    url: `/org/orgAdminController/list`,
    method: 'get',
    params,
    loading,
    autoUntie: false,
  })
}
export function apiAddManage(data) {
  return request({
    url: '/org/orgAdminController/add',
    method: 'post',
    data: data,
  })
}
export function apiEditManage(data) {
  return request({
    url: '/org/orgAdminController/edit',
    method: 'put',
    data: data,
  })
}
export function apiDelManage(ids) {
  return request({
    url: '/org/orgAdminController/' + ids,
    method: 'delete',
  })
}

export const apiEditPassword = (data, loading) => {
  return request({
    url: '/permission/userController/changeAdminPassword',
    method: 'post',
    data,
    loading
  })
}
// 修改配置
export const apiEditConfig = (data, loading) => {
  return request({
    url: '/som/omConfigController/edit',
    method: 'put',
    data,
    loading
  })
}
// 获取配置
export const apiGetConfig = (params, loading) => {
  return request({
    url: '/som/omConfigController/getConfig',
    method: 'get',
    resField: 'obj',
    params,
    loading
  })
}
// 成员转移
export const apiTeamMigrate = (data, loading) => {
  return request({
    url: '/som/shopGroupController/groupTransfer',
    method: 'post',
    data,
    loading
  })
}
// 管理员解锁
export const apiAdminUnlock = (data) => {
  return request({
    url: '/permission/userController/unLockAdmin',
    method: 'post',
    data
  })
}